package unit3;

public class Ex3_11_BoxDemo4 {
    public static void main(String[] args) {
        Box4 mybox1 = new Box4();
        Box4 mybox2 = new Box4();
        double vol; //main（）方法内的变量，是局部变量
        mybox1.lenth = 10;
        mybox1.width = 20;
        mybox2. lenth = 3;
        mybox2. width = 6;
        vol = mybox1.lenth * mybox1.width * Box4.height; //访问类变量height
        System.out.println("mybox1的体积是： " + vol);
        vol = mybox2.lenth * mybox2.width * Box4.height; //访问类变量height
        System.out.println("mybox2的体积是：" + vol);
    }
}
class Box4 {
    double lenth;
    double width;
    static double height = 5; //定义类变量
}
